package com.xyh.flowershop.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.xyh.flowershop.domain.RecevingCode;
import com.xyh.flowershop.vo.req.code.CodePageReqVo;
import com.xyh.flowershop.vo.resp.code.CodePageRespVo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
* @author 10728
* @description 针对表【tb_receving_code】的数据库操作Mapper
* @createDate 2024-05-02 15:56:57
* @Entity com.xyh.flowershop.domain.RecevingCode
*/
public interface RecevingCodeMapper extends BaseMapper<RecevingCode> {

    @Update("update tb_receving_code set is_default = false where user_id = #{userId} ")
    void updateIsDefault(String userId);

    @Select("select id,full_address, is_default, phone, user_name from tb_receving_code  where user_id = #{vo.userId} and " +
            "deleted = false")
    IPage<CodePageRespVo> selectCodePage(IPage<CodePageRespVo> page, @Param("vo") CodePageReqVo vo);

    int removeCodes(List<String> ids);
}




